package com.cedric.yixianpai.game.cards.Sects.swordCards.d_YuanYing;

import com.cedric.yixianpai.game.Constants.CardType;
import com.cedric.yixianpai.game.Constants.Period;
import com.cedric.yixianpai.game.Status.DuelStatus;
import com.cedric.yixianpai.game.interfaces.SwordCard;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class Kuang_2 extends SwordCard {
    /**
     * title:狂剑·二式
     * effect:4/6/9攻 每用过1次狂剑追加1次攻击
     */
    public Kuang_2(@Value("1") int lvl) {
        super("狂剑·二式");
        this.setLevel(lvl);
        this.setCardType(CardType.KUANG);
        this.setPeriod(Period.YUANYING);
        this.setDescription("4/6/9攻 每用过1次狂剑追加1次攻击");
        if (1 == lvl) {
            this.setDamage(4);
        } else if (2 == lvl) {
            this.setDamage(6);
        } else if (3 == lvl) {
            this.setDamage(9);
        } else {
            throw new RuntimeException("Card Level Error!");
        }
    }
    @Override
    public boolean effect(DuelStatus Sta1, DuelStatus Sta2) {
        int i=Sta1.getPlayerBuff().getKuang_Times();
        int v=Sta1.getPlayerBuff().getKuang_Vampire();
        Sta1.attack(Sta2,this.getDamage());
        for (int j = 0; j < i; j++) {
            int hurtValue=Sta1.attack(Sta2,this.getDamage());
            if (v > 0) {
                Sta1.heal(hurtValue * v / 100);//狂剑0式
            }
        }
        Sta1.getPlayerBuff().clearSwordIntent();
        return true;
    }
}
